package com.mythread;

public class Demo3 {
    public static void main(String[] args) {
        Thread1 td1 = new Thread1();
        Thread1 td2 = new Thread1();
        Thread1 td3 = new Thread1();
        Thread1 td = new Thread1();
        td.setName("等待");
        td1.setName("高铁");
        td2.setName("飞机");
        td3.setName("汽车");
        //System.out.println(td2.getPriority());
        //System.out.println(td3.getPriority());
        td2.setPriority(10);
        td3.setPriority(1);
//        td1.start();
        td2.setDaemon(true);
        td3.setDaemon(true);
        td2.start();
        td3.start();
        Thread.currentThread().setName("大陆");
        Thread.currentThread().setPriority(10);
        //td.start();
        try {
            td.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i <11 ; i++) {
            System.out.println(Thread.currentThread().getName()+i);
        }
        //td1.start();
    }
}

class Thread1 extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(getName() + ", " + i);
//            try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
        }
    }
}
